package datatype;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 */

/**
 * @author Yuval
 * 
 */
public class Question {

	private String question = null;
	private int points = 0;
	private List<String> answerList = new ArrayList<String>();
	private int answer = 0;
	private int time = 0;

	// micha need to create the list of those questions
	public Question(String question, int points, List<String> answerList,
			int answer, int time) {
		super();
		this.question = question;
		this.points = points;
		this.answerList = answerList;
		this.answer = answer;
		this.time = time;
	}

	public Question(Utils.Gameplay.Question gamePlayQuestion) {

		question = gamePlayQuestion.getQuestionText();
		points = 10;
		int index = 0;
		int counter = 0;
		for (String answer : gamePlayQuestion.getAnswers().keySet()) {
			answerList.add(answer);
			if (gamePlayQuestion.getAnswers().get(answer)) {
				this.answer = index;
			}
			index++;

			counter++;
		}

		 

	}

	/**
	 * @return the question
	 */
	public String getQuestion() {
		return question;
	}

	/**
	 * @param question
	 *            the question to set
	 */
	public void setQuestion(String question) {
		this.question = question;
	}

	/**
	 * @return the points
	 */
	public int getPoints() {
		return points;
	}

	/**
	 * @param points
	 *            the points to set
	 */
	public void setPoints(int points) {
		this.points = points;
	}

	/**
	 * @return the answerList
	 */
	public List<String> getAnswerList() {
		return answerList;
	}

	/**
	 * @param answerList
	 *            the answerList to set
	 */
	public void setAnswerList(List<String> answerList) {
		this.answerList = answerList;
	}

	/**
	 * @return the answer
	 */
	public int getAnswer() {
		return answer;
	}

	/**
	 * @param answer
	 *            the answer to set
	 */
	public void setAnswer(int answer) {
		this.answer = answer;
	}

	public boolean isCorrectAnswer(int num) {
		return num == answer;
	}

	/**
	 * @return the time
	 */
	public int getTime() {
		return time;
	}

	/**
	 * @param time
	 *            the time to set
	 */
	public void setTime(int time) {
		this.time = time;
	}

}
